package com.yanmaohu.yulia.bean;

/**
 * @author Bright Lee
 */
public final class DomainConstraint {

    private ConstraintNameDefinition constraintNameDefinition;
    private CheckConstraintDefinition checkConstraintDefinition;
    private ConstraintCharacteristics constraintCharacteristics;

    public DomainConstraint(ConstraintNameDefinition constraintNameDefinition,
                            CheckConstraintDefinition checkConstraintDefinition,
                            ConstraintCharacteristics constraintCharacteristics) {
        this.constraintNameDefinition = constraintNameDefinition;
        this.checkConstraintDefinition = checkConstraintDefinition;
        this.constraintCharacteristics = constraintCharacteristics;
    }

    public ConstraintNameDefinition getConstraintNameDefinition() {
        return constraintNameDefinition;
    }

    public CheckConstraintDefinition getCheckConstraintDefinition() {
        return checkConstraintDefinition;
    }

    public ConstraintCharacteristics getConstraintCharacteristics() {
        return constraintCharacteristics;
    }

    public int getEndIndex() {
        if (constraintCharacteristics != null) {
            return constraintCharacteristics.getEndIndex();
        }
        return checkConstraintDefinition.getEndIndex();
    }

}
